/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Pablo
 */
@Entity
@Table(name = "planesociotrad")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Planesociotrad.findAll", query = "SELECT p FROM Planesociotrad p")})
public class Planesociotrad implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPlanesOcioTrad")
    private Integer idPlanesOcioTrad;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 3)
    @Column(name = "idioma")
    private String idioma;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 40)
    @Column(name = "nombreTrad")
    private String nombreTrad;
    @Size(max = 250)
    @Column(name = "descripcion")
    private String descripcion;
    @JoinColumn(name = "idPlanesOcio", referencedColumnName = "idPlanesOcio")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Planesocio idPlanesOcio;

    public Planesociotrad() {
    }

    public Planesociotrad(Integer idPlanesOcioTrad) {
        this.idPlanesOcioTrad = idPlanesOcioTrad;
    }

    public Planesociotrad(Integer idPlanesOcioTrad, String idioma, String nombreTrad) {
        this.idPlanesOcioTrad = idPlanesOcioTrad;
        this.idioma = idioma;
        this.nombreTrad = nombreTrad;
    }

    public Integer getIdPlanesOcioTrad() {
        return idPlanesOcioTrad;
    }

    public void setIdPlanesOcioTrad(Integer idPlanesOcioTrad) {
        this.idPlanesOcioTrad = idPlanesOcioTrad;
    }

    public String getIdioma() {
        return idioma;
    }

    public void setIdioma(String idioma) {
        this.idioma = idioma;
    }

    public String getNombreTrad() {
        return nombreTrad;
    }

    public void setNombreTrad(String nombreTrad) {
        this.nombreTrad = nombreTrad;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Planesocio getIdPlanesOcio() {
        return idPlanesOcio;
    }

    public void setIdPlanesOcio(Planesocio idPlanesOcio) {
        this.idPlanesOcio = idPlanesOcio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPlanesOcioTrad != null ? idPlanesOcioTrad.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Planesociotrad)) {
            return false;
        }
        Planesociotrad other = (Planesociotrad) object;
        if ((this.idPlanesOcioTrad == null && other.idPlanesOcioTrad != null) || (this.idPlanesOcioTrad != null && !this.idPlanesOcioTrad.equals(other.idPlanesOcioTrad))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Planesociotrad[ idPlanesOcioTrad=" + idPlanesOcioTrad + " ]";
    }
    
}
